#ifndef MOTOR_H_
#define MOTOR_H_
#include <metal/cpu.h>
#include <metal/rtc.h>
#include <metal/gpio.h>
#include "pwm.h"
//cmpx
#define MOTOR_R_UP 2
#define MOTOR_L_UP 2
#define MOTOR_R_DOWN 3
#define MOTOR_L_DOWN 1

struct motor{
	int left_cmp,right_cmp;//0-250
	int left_dir,right_dir;//
	long speed,distance,acc;//um/s;um;ug
	int dt;//ms
}Motor;
struct LSM303{
	//加速度计的处理中间值
	unsigned char acc_x_raw,acc_z_raw,acc_x_comple,acc_z_comple,acc_x_filter,acc_z_filter;
	//磁力传感器的处理中间值
}lsm303;
void motor_init();
void motor_run();
#endif
